package io.renren.modules.PCguanli.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.PCguanli.dao.LineDeptDao;
import io.renren.modules.PCguanli.entity.LineDeptEntity;
import io.renren.modules.PCguanli.service.LineDeptService;


@Service("lineDeptService")
public class LineDeptServiceImpl extends ServiceImpl<LineDeptDao, LineDeptEntity> implements LineDeptService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<LineDeptEntity> page = this.page(
                new Query<LineDeptEntity>().getPage(params),
                new QueryWrapper<LineDeptEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<LineDeptEntity> list(Map<String, Object> params) {
        String deptName = (String)params.get("deptName");
        List<LineDeptEntity> list=this.list(
                new QueryWrapper<LineDeptEntity>()
                        .like(StringUtils.isNotBlank(deptName),"dept_name",deptName)
        );
        return list;
    }

}